package DisplayDatas;

import java.util.*;

import DataObjects.Topic;

public class TopicToDisplay {
	private int id;
	private String name;
	private Vector<String> words;
	private int countFound;
	private Vector<TopicToDisplay> fathers;
	private Vector<TopicToDisplay> children;
	
	public TopicToDisplay(int id,String name,int countFound){//TODO not need
		this.id=id;
		this.name=name;
		this.countFound=countFound;
		fathers=new Vector<TopicToDisplay>();
		children=new Vector<TopicToDisplay>();
		words=new Vector<String>();
	}
	
	public TopicToDisplay(Topic topic){
		this.name=topic.getName();
		this.id=topic.getId();
		words=topic.getWords();
		
		this.countFound=0;
		fathers=new Vector<TopicToDisplay>();
		children=new Vector<TopicToDisplay>();
	}
	
	public void addToCountFound(){
		countFound++;
	}
	
	public void addChild(TopicToDisplay boy){
		children.add(boy);
		boy.fathers.add(this);
	}

	public int getId() {
		return id;
	}

	public String getName() {
		return name;//TODO do a normal name
	}

	public int getCountFound() {
		return countFound;
	}
	
	public Vector<String> getWords(){
		return this.words;
	}

	public Vector<TopicToDisplay> getFathers() {
		Vector<TopicToDisplay> ans=new Vector<TopicToDisplay>();
		for(TopicToDisplay childId : fathers)
			ans.add(childId);
		return ans;
	}
	
	public Iterator<TopicToDisplay> getFathersIterator() {
		return fathers.iterator();
	}
	
	public Vector<TopicToDisplay> getChildren() {
		Vector<TopicToDisplay> ans=new Vector<TopicToDisplay>();
		for(TopicToDisplay childId : children)
			ans.add(childId);
		return ans;
	}
	
	public Iterator<TopicToDisplay> getChildrenIterator() {
		return children.iterator();
	}
}
